<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%--使用taglib 引入标签库--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/pintuer.css">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/admin.css">
    <script src="<%=request.getContextPath()%>/js/jquery.js"></script>
    <script src="<%=request.getContextPath()%>/js/demo.page.js"></script>
    <script src="<%=request.getContextPath()%>/js/excel-gen.js"></script>
    <script src="<%=request.getContextPath()%>/js/FileSaver.js"></script>
    <script src="<%=request.getContextPath()%>/js/jszip.min.js"></script>
    <script src="<%=request.getContextPath()%>/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="LeaveServlet?action=exports" id="listform">
    <div class="panel admin-panel">
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li> <a class="button border-main icon-plus-square-o" href="" id="generate-excel">导出Excel文件</a> </li>

                <li>
                    <input type="text" placeholder="请输入请假单编号" name="leaveID" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <input type="text" placeholder="请输入课程编号" name="courseID" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <input type="text" placeholder="请输入学生学号" name="stuNo" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <input type="text" placeholder="请输入审核状态" name="status" class="input" style="width:250px; line-height:17px;display:inline-block" />

                    <a href="javascript:void(0)" class="button border-main icon-search" onclick="changeSearch()" > 搜索</a></li>
            </ul>
        </div>
        <table class="table table-hover text-center" id="LeaveTable">
            <tr>
                <th >请假编号</th>
                <th >课程编号</th>
                <th >请假事由</th>
                <th >请假天数</th>
                <th >学生学号</th>
                <th >请假时间</th>
                <th >审核状态</th>
                <th >审核时间</th>
                <th >审核意见</th>
            </tr>
            <%--使用JSTL标签库的迭代标签输出userlist集合的元素--%>
            <c:forEach var="item" items="${requestScope.exportlist}" >
                <tr>
                    <td>${item.leaveID}</td>
                    <td>${item.courseID}</td>
                    <td>${item.reason}</td>
                    <td>${item.daynum}</td>
                    <td>${item.stuNo}</td>
                    <td>${item.applytime}</td>
                    <td><c:choose>
                        <c:when test="${item.status==1}">
                            <span style="color: #00aa00">同意</span>
                        </c:when>
                        <c:when test="${item.status==2}">
                            <span style="color: red">不同意</span>
                        </c:when>
                        <c:otherwise>
                            待审核
                        </c:otherwise>
                    </c:choose>
                    </td>

                    <td>${item.audittime}</td>
                    <td>${item.opinion}</td>
                </tr>
            </c:forEach>
        </table>
    </div>
</form>
<script>
    function changeSearch(){
        $("#listform").submit();
    }

    $(document).ready(function(){
        excel = new ExcelGen({
            "src_id":"LeaveTable",//table的id
            "show_header":true
        });
        $("#generate-excel").click(function () {
            excel.generate();//执行导入包中的方法。
        })
    });
</script>
</body>
</html>

